from fastapi import FastAPI

from app.admin.api import users_router, roles_router, resources_router, tenants_router
from app.api import auth, admin

def setup_routes(app: FastAPI):
    """
    配置应用路由
    """
    # 添加路由
    app.include_router(tenants_router, prefix="/api/v1/tenants", tags=["tenants"])
    app.include_router(users_router, prefix="/api/v1/tenants/{tenant_id}/users", tags=["users"])
    app.include_router(auth.router, prefix="/api/v1/auth", tags=["auth"])
    # app.include_router(admin.router, prefix="/api/v1/admin", tags=["admin"])
    app.include_router(roles_router, prefix="/api/v1/tenants/{tenant_id}/roles", tags=["roles"])
    app.include_router(resources_router, prefix="/api/v1/tenants/{tenant_id}/resources", tags=["resources"])

    @app.get("/")
    def root():
        return {"message": "Welcome to the FastAPI application"}